﻿'use strict';
var $ = null, element = null;
layui.config({
    base: '/Common/layim/layui_exts/' //指定 插件 路径
    , version: '1.0.0-beta'
}).define(['table', 'jquery', 'form', 'layer', 'laydate', 'tree', 'Vue', 'util', 'VueRouter', 'httpVueLoader'], function (exports) {
    $= layui.jquery, element = layui.element; var Vue = layui.Vue, VueRouter = layui.VueRouter, httpVueLoader = layui.httpVueLoader;//, common = layui.common;


    //注册路由这里IE下不能正常运行，不支持IE 支持微信
    var menus = [

        {
            show: true,
            ioc: "fa fa-book fa-spin",
            name: "学海无涯",
            path: "/news",
            component: "/weixin/news.html"
        },
        {
            show: true,
            ioc: "fa fa-download fa-spin",
            name: "分享下载",
            path: "/message",
            component: "/weixin/message.html"
        },
        {
            show: true,
            ioc: "fa fa-shopping-cart fa-spin",
            name: "淘券券",
            path: "/myban",
            component: "/weixin/myban.html"
        },
        {
            show: true,
            ioc: "fa fa-grav fa-open",
            name: "开发者",
            path: "/open/:type",
            component: "/weixin/open.html"
        }, {
            show: true,
            ioc: "fa fa-free-code-camp fa-spin",
            name: "磁力链接",
            path: "/setting",
            component: "/weixin/setting.html"
        }, {
            show: false,
            ioc: "",
            name: "详情",
            path: "/newsDetail/:key",
            component: "/weixin/newsDetail.html"
        },
        // 重定向
        {
            show: false,
            path: '*',
            redirect: '/mian',
            component: "/weixin/mian.html"
        }
    ];
    var routes = []; var _muen = [];
    $(menus).each(function (index, menu) {

        //  for (let menu of menus) {
        if (menu.show) {
            _muen.push(menu);
        }
        routes.push({
            path: menu.path,
            component: httpVueLoader(menu.component)
        });
    });

    var router = new VueRouter({
        routes: routes
    });
    var us = new Array();
    us.id = window.localStorage["userid"];
    us.name = window.localStorage["user"];
    us.orid = window.localStorage["orid"];
    us.orname = window.localStorage["orname"];
    us.picture = window.localStorage["picture"];

   var _vue = Vue.use(httpVueLoader);
    new Vue({

        router: router,
        el: '#app',
        data: {
            users: us,
            menus: _muen
        }

    });


    Android = {
        //加载b广告
        LoadbrADD: function () { AndroidWebView.LoadbrADD(); },
        //插屏广告
        LoadcpADD: function () { AndroidWebView.LoadcpADD(); },
    }
    exports('weixin', Android);
})
